﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 数据结构课设_电文的编码与译码_CSharp
{
    /// <summary>
    /// 结点类
    /// </summary>
    public class Node
    {
        /// <summary>
        /// 左子树
        /// </summary>
        public Node LChild;
        /// <summary>
        /// 右子树
        /// </summary>
        public Node RChild;
        /// <summary>
        /// 前结点
        /// </summary>
        public Node Previous;
        /// <summary>
        /// 后结点
        /// </summary>
        public Node Next;
        /// <summary>
        /// 权值
        /// </summary>
        public ulong Weight=0;
        /// <summary>
        /// 原字符
        /// </summary>
        public char Key;
        /// <summary>
        /// 哈夫曼编码
        /// </summary>
        public string Code;
        public Node(){ }
        /// <summary>
        /// 构造方法,设置节点值
        /// </summary>
        public Node(ulong weight)
        {
            this.Weight = weight;
        }
        /// <summary>
        /// 构造方法,设置节点值
        /// </summary>
        public Node(ulong weight, char value)
        {
            this.Weight = weight;
            this.Key = value;
        }
        /// <summary>
         /// 构造方法,设置节点值
         /// </summary>
        public Node(char key_value, string code_value)
        {
            this.Key = key_value;
            this.Code = code_value;
        }
    }
}
